function TbReturnCoupon(params){ 
	 
}

TbReturnCoupon.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new TbReturnCoupon.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new TbReturnCoupon.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new TbReturnCoupon.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	
	
	/** 编号 [非空]       **/
	this.tbrcId=function(tbrcId){if(this.proxy)return this.getProxy().tbrcId(tbrcId);  this.put("tbrcId", tbrcId);return this;};
	/** and tbrc_id is null */
	this.tbrcIdNull=function(){if(this.proxy)return this.getProxy().tbrcIdNull();if(this.get("tbrcIdNot")==null)this.put("tbrcIdNot", "");this.put("tbrcId", null);return this;};
	/** not .... */
	this.tbrcIdNot=function(){if(this.proxy)return this.getProxy().tbrcIdNot();this.put("tbrcIdNot", "not");return this;};
	this.tbrcIdNotNull=function(){if(this.proxy)return this.getProxy().tbrcIdNotNull();this.put("tbrcIdNot", "not");this.put("tbrcId", null);return this;};
	this.tbrcIdNot=function(tbrcId){if(this.proxy)return this.getProxy().tbrcIdNot(tbrcId);this.put("tbrcIdNot", "not");this.put("tbrcId", tbrcId);return this;};
		
	/** and tbrc_id <= ? */
	this.tbrcIdMin=function(min){if(this.proxy)return this.getProxy().tbrcIdMin(min);this.put("tbrcIdMin", min);return this;};
	/** and tbrc_id >= ? */
	this.tbrcIdMax=function(max){if(this.proxy)return this.getProxy().tbrcIdMax(max);this.put("tbrcIdMax", max);return this;};
		
		
	this.tbrcIdIn=function(ids){
		if(this.proxy)return this.getProxy().tbrcIdIn(ids);  this.put("tbrcIdIn", ids);return this;
	};	
		 
	
	
	/** 会员        **/
	this.tbrcMember=function(tbrcMember){if(this.proxy)return this.getProxy().tbrcMember(tbrcMember);  this.put("tbrcMember", tbrcMember);return this;};
	/** and tbrc_member is null */
	this.tbrcMemberNull=function(){if(this.proxy)return this.getProxy().tbrcMemberNull();if(this.get("tbrcMemberNot")==null)this.put("tbrcMemberNot", "");this.put("tbrcMember", null);return this;};
	/** not .... */
	this.tbrcMemberNot=function(){if(this.proxy)return this.getProxy().tbrcMemberNot();this.put("tbrcMemberNot", "not");return this;};
	this.tbrcMemberNotNull=function(){if(this.proxy)return this.getProxy().tbrcMemberNotNull();this.put("tbrcMemberNot", "not");this.put("tbrcMember", null);return this;};
	this.tbrcMemberNot=function(tbrcMember){if(this.proxy)return this.getProxy().tbrcMemberNot(tbrcMember);this.put("tbrcMemberNot", "not");this.put("tbrcMember", tbrcMember);return this;};
		
	/** and tbrc_member <= ? */
	this.tbrcMemberMin=function(min){if(this.proxy)return this.getProxy().tbrcMemberMin(min);this.put("tbrcMemberMin", min);return this;};
	/** and tbrc_member >= ? */
	this.tbrcMemberMax=function(max){if(this.proxy)return this.getProxy().tbrcMemberMax(max);this.put("tbrcMemberMax", max);return this;};
		
		
	this.tbrcMemberIn=function(ids){
		if(this.proxy)return this.getProxy().tbrcMemberIn(ids);  this.put("tbrcMemberIn", ids);return this;
	};	
		 
	
	
	/** 邀请人        **/
	this.tbrcYq=function(tbrcYq){if(this.proxy)return this.getProxy().tbrcYq(tbrcYq);  this.put("tbrcYq", tbrcYq);return this;};
	/** and tbrc_yq is null */
	this.tbrcYqNull=function(){if(this.proxy)return this.getProxy().tbrcYqNull();if(this.get("tbrcYqNot")==null)this.put("tbrcYqNot", "");this.put("tbrcYq", null);return this;};
	/** not .... */
	this.tbrcYqNot=function(){if(this.proxy)return this.getProxy().tbrcYqNot();this.put("tbrcYqNot", "not");return this;};
	this.tbrcYqNotNull=function(){if(this.proxy)return this.getProxy().tbrcYqNotNull();this.put("tbrcYqNot", "not");this.put("tbrcYq", null);return this;};
	this.tbrcYqNot=function(tbrcYq){if(this.proxy)return this.getProxy().tbrcYqNot(tbrcYq);this.put("tbrcYqNot", "not");this.put("tbrcYq", tbrcYq);return this;};
		
	/** and tbrc_yq <= ? */
	this.tbrcYqMin=function(min){if(this.proxy)return this.getProxy().tbrcYqMin(min);this.put("tbrcYqMin", min);return this;};
	/** and tbrc_yq >= ? */
	this.tbrcYqMax=function(max){if(this.proxy)return this.getProxy().tbrcYqMax(max);this.put("tbrcYqMax", max);return this;};
		
		
	this.tbrcYqIn=function(ids){
		if(this.proxy)return this.getProxy().tbrcYqIn(ids);  this.put("tbrcYqIn", ids);return this;
	};	
		 
	
	
	/** 品牌        **/
	this.tbrcBrand=function(tbrcBrand){if(this.proxy)return this.getProxy().tbrcBrand(tbrcBrand);  this.put("tbrcBrand", tbrcBrand);return this;};
	/** and tbrc_brand is null */
	this.tbrcBrandNull=function(){if(this.proxy)return this.getProxy().tbrcBrandNull();if(this.get("tbrcBrandNot")==null)this.put("tbrcBrandNot", "");this.put("tbrcBrand", null);return this;};
	/** not .... */
	this.tbrcBrandNot=function(){if(this.proxy)return this.getProxy().tbrcBrandNot();this.put("tbrcBrandNot", "not");return this;};
	this.tbrcBrandNotNull=function(){if(this.proxy)return this.getProxy().tbrcBrandNotNull();this.put("tbrcBrandNot", "not");this.put("tbrcBrand", null);return this;};
	this.tbrcBrandNot=function(tbrcBrand){if(this.proxy)return this.getProxy().tbrcBrandNot(tbrcBrand);this.put("tbrcBrandNot", "not");this.put("tbrcBrand", tbrcBrand);return this;};
		
	/** and tbrc_brand <= ? */
	this.tbrcBrandMin=function(min){if(this.proxy)return this.getProxy().tbrcBrandMin(min);this.put("tbrcBrandMin", min);return this;};
	/** and tbrc_brand >= ? */
	this.tbrcBrandMax=function(max){if(this.proxy)return this.getProxy().tbrcBrandMax(max);this.put("tbrcBrandMax", max);return this;};
		
		
	this.tbrcBrandIn=function(ids){
		if(this.proxy)return this.getProxy().tbrcBrandIn(ids);  this.put("tbrcBrandIn", ids);return this;
	};	
		 
	
	
	/** 优惠券        **/
	this.tbrcCoupon=function(tbrcCoupon){if(this.proxy)return this.getProxy().tbrcCoupon(tbrcCoupon);  this.put("tbrcCoupon", tbrcCoupon);return this;};
	/** and tbrc_coupon is null */
	this.tbrcCouponNull=function(){if(this.proxy)return this.getProxy().tbrcCouponNull();if(this.get("tbrcCouponNot")==null)this.put("tbrcCouponNot", "");this.put("tbrcCoupon", null);return this;};
	/** not .... */
	this.tbrcCouponNot=function(){if(this.proxy)return this.getProxy().tbrcCouponNot();this.put("tbrcCouponNot", "not");return this;};
	this.tbrcCouponNotNull=function(){if(this.proxy)return this.getProxy().tbrcCouponNotNull();this.put("tbrcCouponNot", "not");this.put("tbrcCoupon", null);return this;};
	this.tbrcCouponNot=function(tbrcCoupon){if(this.proxy)return this.getProxy().tbrcCouponNot(tbrcCoupon);this.put("tbrcCouponNot", "not");this.put("tbrcCoupon", tbrcCoupon);return this;};
		
	/** and tbrc_coupon <= ? */
	this.tbrcCouponMin=function(min){if(this.proxy)return this.getProxy().tbrcCouponMin(min);this.put("tbrcCouponMin", min);return this;};
	/** and tbrc_coupon >= ? */
	this.tbrcCouponMax=function(max){if(this.proxy)return this.getProxy().tbrcCouponMax(max);this.put("tbrcCouponMax", max);return this;};
		
		
	this.tbrcCouponIn=function(ids){
		if(this.proxy)return this.getProxy().tbrcCouponIn(ids);  this.put("tbrcCouponIn", ids);return this;
	};	
		 
	
	
	/** 领取情况    1:未领取 2:已领取     **/
	this.tbrcGet=function(tbrcGet){if(this.proxy)return this.getProxy().tbrcGet(tbrcGet);  this.put("tbrcGet", tbrcGet);return this;};
	/** and tbrc_get is null */
	this.tbrcGetNull=function(){if(this.proxy)return this.getProxy().tbrcGetNull();if(this.get("tbrcGetNot")==null)this.put("tbrcGetNot", "");this.put("tbrcGet", null);return this;};
	/** not .... */
	this.tbrcGetNot=function(){if(this.proxy)return this.getProxy().tbrcGetNot();this.put("tbrcGetNot", "not");return this;};
	this.tbrcGetNotNull=function(){if(this.proxy)return this.getProxy().tbrcGetNotNull();this.put("tbrcGetNot", "not");this.put("tbrcGet", null);return this;};
	this.tbrcGetNot=function(tbrcGet){if(this.proxy)return this.getProxy().tbrcGetNot(tbrcGet);this.put("tbrcGetNot", "not");this.put("tbrcGet", tbrcGet);return this;};
		
		
	this.tbrcGetIn=function(ids){
		if(this.proxy)return this.getProxy().tbrcGetIn(ids);  this.put("tbrcGetIn", ids);return this;
	};	
		 
	
	
	/** 添加时间        **/
	this.tbrcAddTime=function(tbrcAddTime){if(this.proxy)return this.getProxy().tbrcAddTime(tbrcAddTime);  this.put("tbrcAddTime", tbrcAddTime);return this;};
	/** and tbrc_add_time is null */
	this.tbrcAddTimeNull=function(){if(this.proxy)return this.getProxy().tbrcAddTimeNull();if(this.get("tbrcAddTimeNot")==null)this.put("tbrcAddTimeNot", "");this.put("tbrcAddTime", null);return this;};
	/** not .... */
	this.tbrcAddTimeNot=function(){if(this.proxy)return this.getProxy().tbrcAddTimeNot();this.put("tbrcAddTimeNot", "not");return this;};
	this.tbrcAddTimeNotNull=function(){if(this.proxy)return this.getProxy().tbrcAddTimeNotNull();this.put("tbrcAddTimeNot", "not");this.put("tbrcAddTime", null);return this;};
	this.tbrcAddTimeNot=function(tbrcAddTime){if(this.proxy)return this.getProxy().tbrcAddTimeNot(tbrcAddTime);this.put("tbrcAddTimeNot", "not");this.put("tbrcAddTime", tbrcAddTime);return this;};
		
	/** and tbrc_add_time >= ? */
	this.tbrcAddTimeStart=function(start){if(this.proxy)return this.getProxy().tbrcAddTimeStart(start);this.put("tbrcAddTimeStart", start);return this;};			
	/** and tbrc_add_time <= ? */
	this.tbrcAddTimeEnd=function(end){if(this.proxy)return this.getProxy().tbrcAddTimeEnd(end);this.put("tbrcAddTimeEnd", end);return this;};
		
		 
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有回归优惠券 **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/coupons/returncoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取回归优惠券分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/coupons/returncoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取回归优惠券 **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/coupons/returncoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

TbReturnCoupon.get = function(id){
	var protocol = ux.ajax("/admin/coupons/returncoupon.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.tbReturnCoupon;
	return null;
}

TbReturnCoupon.where = new TbReturnCoupon.Where(0,true);